#coding:utf-8
import re, random
import zipfile, os

old_file='E:/0_360os_workspace/git/2048/reborn1/build/web-mobile/cocos2d-js-min.js'
fopen=open(old_file,'r')
w_str= ''
for line in fopen:
  if re.search('highp',line):
    line=re.sub('highp','mediump',line)
    w_str+=line
  else:
    w_str+=line
w_str += ';window.version = ' + str(random.uniform(10, 20)).replace('.','') + ";"

# wopen=open(old_file,'w')
# wopen.write(w_str)
# fopen.close()
# wopen.close()

# fantasy_zip = zipfile.ZipFile('E:/0_360os_workspace/git/2048/reborn1/build/web-mobile.zip', 'w')
# for folder, subfolders, files in os.walk('E:/0_360os_workspace/git/2048/reborn1/build/web-mobile'):
#     for file in files:
#       fantasy_zip.write(os.path.join(folder, file), os.path.relpath(os.path.join(folder,file) , 'E:/0_360os_workspace/git/2048/reborn1/build/web-mobile'), compress_type = zipfile.ZIP_DEFLATED)
# fantasy_zip.close()

# os.system("pause")
